home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / rlnk110.zip / RIPDOOR.PAS < prev    next >
Pascal/Delphi Source File  |  1994-02-21  |  6KB  |  169 lines

  1. Program RIPDoor;
  2.  
  3. {$F+}
  4.  
  5. { RipDoor (RipDoor) - Copyright (C) 1994 by InterProgramming      }
  6. {                     All rights reserved.                        }
  7. { Version 1.10      - For distribution with RipLink.              }
  8. {                     FREE to all registered RipLink users.       }
  9.  
  10. { This is a sample program to show the use of RIPlink.  RIPlink is a }
  11. { standalone product and requires the use of a door toolkit.  This   }
  12. { example covers both using RIPlink and interfacing with a door      }
  13. { toolkit.                                                           }
  14.  
  15. { This sample makes reference to "DoorKit."  DoorKit is just a general }
  16. { reference to any door toolkit.                                       }
  17.  
  18. { This example displays a simple screen to the user composed of various      }
  19. { things that RIPscrip supports.  Then it will wait for a character and then }
  20. { display the RIP file, CITY.RIP.  We've provided CITY.RIP as a convenience  }
  21. { to you.                                                                    }
  22.  
  23.  
  24. uses
  25.   Dos, Crt, DoorKit, RIPlink;
  26.  
  27. Type
  28. {The RipLink Object - needed because we're overriding one procedure}
  29.   RIPtr = ^RIPObject;
  30.   RIPObject = object(RIPObj)
  31.     procedure sendstr(instr : string); virtual;
  32.   end;
  33.  
  34. Var
  35.   dummych       : char;
  36.   RIP           : RIPtr; {an instance of the object}
  37.  
  38. Procedure RIPObject.SendStr(instr : string);
  39. {give RipLink the command to send strings out the modem}
  40. begin
  41.   DisplayRemote(instr+#13#10); {DisplayRemote is a DoorKit procedure that
  42.                                 sends strings over the modem without
  43.                                 displaying them locally.}
  44. end;
  45.  
  46. Procedure StatusL;
  47. {Graphics procedure to override the DoorKit one}
  48. {This can be as extensive or simple as you want it to be.}
  49. var
  50.   tstr  : string[75];
  51. begin
  52.   tstr := UserName+', '+baud+', Time: '+inttostr(timeremaining);
  53.   RIP^.StatText := tstr;
  54.   RIP^.StatLine;
  55. end;
  56.  
  57. Procedure InitDoor;
  58. {initializes door}
  59. begin
  60.   RIP := nil;     {clears pointer (to object)}
  61.   ProcessParams;  {a DoorKit procedure}
  62.   ReadDoorFile;   {another DoorKit procedure}
  63.   
  64.   {RIPexist : boolean; : Does the user want RIP? (a DoorKit variable}
  65.   if RIPexist then         {if user wants rip, initialize the object}
  66.     New(RIP,Init(DoRIP));  {DoRIP : boolean; : Do graphics LOCALLY?}
  67.   
  68.   initcomm; {DoorKit procedure}
  69.   if initfail then
  70.   begin
  71.     writeln('Error: Initializing Communications port.  Exiting.');
  72.     if RIP <> nil then      {this is important!}
  73.       Dispose(RIP, Done);
  74.     Closecomm; {DoorKit procedure}
  75.     Halt(1);
  76.   end;
  77.  
  78.   {IcnPath : pathstr; : Path of local icon files}
  79.   RIP^.IconDir := IcnPath;    {RIPlink must be told where the icons are}
  80.   if DoRIP and RIPexist then  {if the sysop wants Rip (DoRip) then assign the
  81.                                graphics stat line to the status proc}
  82.     StatProc := StatusL;
  83. end;
  84.  
  85. Procedure Header;
  86. const
  87.   test : fpt = (146,73,36,146,73,36,146,73);
  88.   t2   : fpt = (127,159,231,227,235,141,189,254);
  89. var
  90.   bla  : boolean;
  91. begin
  92.   if RIPexist then    {See below comment below for line:
  93.                        if (not RIPexist) or (not DoRip) then}
  94.   begin
  95.     RIP^.RipResetWindows;
  96.       {good idea at beginning of every scene}
  97.     RIP^.RipSetPalette(0,1,2,3,4,5,7,20,56,57,58,59,60,61,62,63);
  98.       {define the color palette - this is the default setting}
  99.     RIP^.RipTextWindow(1,8,80,20,true,0);
  100.       {define a text window}
  101.     RIP^.RipButtonStyle(0,0,2,768,3,15,0,15,8,7,0,0,15,7);
  102.       {define a button style}
  103.     RIP^.RipWriteMode(0);
  104.       {set the write mode}
  105.     RIP^.RipColor(12);
  106.       {set the drawing color}
  107.     RIP^.RipLineStyle(0,0,3);
  108.       {set the line style}
  109.     RIP^.RipFontStyle(2,0,1);
  110.       {set the font type and style (Font 2)}
  111.     RIP^.RipTextXY(10,4,'InterProgramming');
  112.     RIP^.RipColor(14);
  113.     RIP^.RipTextXY(14,9,'InterProgramming');
  114.     RIP^.RipColor(11);
  115.     RIP^.RipTextXY(18,14,'InterProgramming');
  116.     RIP^.RipColor(10);
  117.     RIP^.RipTextXY(22,19,'InterProgramming');
  118.     RIP^.RipColor(13);
  119.     RIP^.RipTextXY(26,25,'InterProgramming');
  120.     RIP^.RipColor(12);
  121.     RIP^.RipLoadIcon(10,100,0,true,'computer.icn');
  122.     RIP^.RipPutImage(70,100,0);
  123.       {copy image from clipboard - happens to be icon because of last command}
  124.     RIP^.RipFillPattern(test,9);
  125.       {define a fill pattern - see const above}
  126.     RIP^.RipBar(250,100,450,150);
  127.     RIP^.RipFillPattern(t2,6);
  128.     RIP^.RipBar(250,175,450,250);
  129.     RIP^.RipButtonStyle(0,0,0,768,0,11,0,15,8,9,0,0,0,13);
  130.     RIP^.RipPixel(0,4);
  131.     RIP^.RipButton(50,180,200,260,0,0,'','Button','');
  132.     dummych := getch; {wait for a char; GetCh is a DoorKit function}
  133.  
  134.     RIP^.RipResetWindows; {reset everything again}
  135.     bla := RIP^.DisplayRIPfile('city.rip'); {display the RIP file CITY.RIP}
  136.     dummych := getch; {wait for a char}
  137.   end;
  138.   if (not RIPexist) or (not DoRip) then {This line and the line mentioned
  139.                                          above handle RIP/non-RIP callers.
  140.                                          Necessary to handle the sysop who
  141.                                          doesn't want RIP even when the user
  142.                                          does}
  143.   begin
  144.     clearscreen; {DoorKit proc}
  145.     colorset(12,0); {DoorKit proc}
  146.     displayln('InterProgramming'); {DoorKit proc}
  147.     colorset(14,0);
  148.     displayln(' InterProgramming');
  149.     colorset(11,0);
  150.     displayln('  InterProgramming');
  151.     colorset(10,0);
  152.     displayln('   InterProgramming');
  153.     colorset(13,0);
  154.     displayln('    InterProgramming');
  155.     displayln('');
  156.   end;
  157. end;
  158.  
  159. Begin               {main block}
  160.   {UnRegDelay := false;} {prompt for a random number when unregistered
  161.                           number will have to be entered locally}
  162.   UnRegDelay := true;    {delay for 10 seconds when unregistered}
  163.   InitDoor;
  164.   Header;
  165.   dummych := getch; {wait for a char}
  166.   if RIP <> nil then    {IMPORTANT!}
  167.     Dispose(RIP, Done);
  168. End.
  169.